from django.core.files.storage import Storage
from django.conf import settings


class FastDFSStorage(Storage):
    """自定义文件存储系统"""
    def __init__(self, fdfs_base_url=None):
        self.fdfs_base_url = fdfs_base_url or settings.FDFS_BASE_URL

    def _open(self, name, mode='rb'):
        #  用于打开文件
        pass

    def _save(self, name, content):
        #  用于保存文件
        pass

    def url(self, name):
        #  返回name所指文件的路径
        return self.fdfs_base_url + name
